/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package searchsort;

/**
 *
 * @author parallels
 */
public class LinearSearch {
    
    public static MyDataBean search(int key, MyDataBeanArray myArray) {
        MyDataBean result = null;
        String message = "not found";
        for (int i=0; i < myArray.size(); ++i) {
            if (key == myArray.get(i).getKey()) {
                result = myArray.get(i);
                message = "founded at " + i;
                break;
            }
        }
        System.out.println(message);
        return result;
    }
    
}
